<title>三级级资质审查列表</title>
<!-- /section:settings.box -->
<div class="row aptitude_listchild">
	<div class="col-xs-12">
		<div class="ad_so">
			<input type="text" id="hx_c_unit" class="input-large"
				placeholder="建设单位">
			<button type="button" class="btn btn-info serach">
				<i class="glyphicon glyphicon-search"></i> 搜索
			</button>
		</div>
		<div class="tabbable tabbable2">
			<ul class="nav nav-tabs padding-12 tab-color-blue background-blue">
				<li name="li_tab" data-identity="-1" class="active"><a
					href="javascript:;">全部（20）</a></li>
				<li name="li_tab" data-identity="1"><a href="javascript:;">提交初审（23）</a></li>
				<li name="li_tab" data-identity="2"><a href="javascript:;">初审通过（9）</a></li>
				<li name="li_tab" data-identity="3"><a href="javascript:;">初审退回（4）</a></li>
				<li name="li_tab" data-identity="4"><a href="javascript:;">原件审核（3）</a></li>
				<li name="li_tab" data-identity="5"><a href="javascript:;">上报评审会（1）</a></li>
				<li name="li_tab" data-identity="6"><a href="javascript:;">材料补正（1）</a></li>
				<li name="li_tab" data-identity="7"><a href="javascript:;">通过（2）</a></li>
				<li name="li_tab" data-identity="8"><a href="javascript:;">公示（4）</a></li>
				<li name="li_tab" data-identity="9"><a href="javascript:;">公告（1）</a></li>
				<li name="li_tab" data-identity="10"><a href="javascript:;">发证（1）</a></li>
			</ul>
		</div>
		<div class="row">
			<div class="col-xs-12">
				<div>
					<table class="table table-striped table-bordered table-hover">
						<thead>
							<tr>
								<th>受理号</th>
								<th>建设单位</th>
								<th>经办人</th>
								<th>联系方式</th>
								<th>受理时间</th>
								<th>状态</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody class="data" style="display: table-row-group;">

						</tbody>
					</table>
				</div>
			</div>
		</div>
		<!--<div class="pull-left">
			<button type="button" class="btn btn-info add" data-identity="add"
				title="新增">
				<i class="ace-icon glyphicon glyphicon-plus"></i>新增
			</button>
		</div>-->
		<!--分页-->
		<nav class="pull-right">
			<ul class="pagination">
				<li><a class="first" href="javascript:void(1);"
					aria-label="Previous"> 首页</a></li>
				<li><a class="prev" href="javascript:void(1);"><i
						class="ace-icon fa fa-angle-double-left"></i>上一页</a></li>
				<li><a class="next" href="javascript:void(1);">下一页<i
						class="ace-icon fa fa-angle-double-right"></i></a></li>
				<li><a class="last" href="javascript:void(1);" aria-label="Next">尾页</a>
				</li>
				<li><a class="go_page" href="javascript:void(1);">跳转到</a></li>
				<li><input type="text" style="width: 30px" class="go_num" value="1"></li>
				<li>页</li>
			</ul>
		</nav>
		<!-- TemplteHidden -->
		<table class="list-tpl hidden">
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td>
					<button type="button" class="btn btn-mini btn-pink shencha"
						data-identity="online" title="在线审查">
						<i class="ace-icon glyphicon glyphicon-eye-open"> 在线审查</i>
					</button>
					<button type="button" class="btn btn-mini btn-info yjsh"
						data-identity="online_yjsh" title="原件审核">
						<i class="ace-icon glyphicon glyphicon-file"> 原件审核</i>
					</button>
					<button type="button" class="btn btn-mini btn-purple sbpsh"
						data-identity="online_sbpsh" title="上报评审会">
						<i class="ace-icon glyphicon glyphicon-print"> 上报评审会</i>
					</button>
					<button type="button" class="btn btn-mini btn-success clbz"
						data-identity="online_clbz" title="材料补正">
						<i class="ace-icon glyphicon glyphicon-file"> 材料补正</i>
					</button>
					<button type="button" class="btn btn-mini btn-info tg"
						data-identity="online_tg" title="通过">
						<i class="ace-icon glyphicon glyphicon-ok"> 通过</i>
					</button>
					<button type="button" class="btn btn-mini btn-pink gs"
						data-identity="online_gs" title="公式">
						<i class="ace-icon glyphicon glyphicon-eye-open"> 公示</i>
					</button>
					<button type="button" class="btn btn-mini btn-pink gg"
						data-identity="online_gg" title="公告">
						<i class="ace-icon glyphicon glyphicon-eye-open">公告</i>
					</button>
					<button type="button" class="btn btn-mini btn-danger fz"
						data-identity="online_fz" title="发证">
						<i class="ace-icon glyphicon glyphicon-list-alt"> 发证</i>
					</button>
				</td>
			</tr>
		</table>
	</div>
</div>
<script type="text/javascript">
var scripts = [null, null];
$('.page-content-area').ace_ajax('loadScripts', scripts, function() {
	var $scope = $('.aptitude_listchild');
	function pageInit(page){
		$.getJSON(page.url,
		{
			page:page.pi
		},					
		function(ret)
		{
			if(ret.status==200)
			{
				var $data=$('.data',$scope);
				$data.hide();
				$data.empty();
				var data=ret.data;							
				pageObj.set_page_count_without_action(ret.page_count);
				$("li[name='li_tab'][data-identity='-1']>a",$scope).text("全部（"+ret.tct+"）");
				$("li[name='li_tab'][data-identity='1']>a",$scope).text("提交初审（"+ret.tjcs_ct+"）");
				$("li[name='li_tab'][data-identity='2']>a",$scope).text("初审通过（"+ret.cstg_ct+"）");
				$("li[name='li_tab'][data-identity='3']>a",$scope).text("初审退回（"+ret.csth_ct+"）");
				$("li[name='li_tab'][data-identity='4']>a",$scope).text("原件审核（"+ret.yjsh_ct+"）");
				$("li[name='li_tab'][data-identity='5']>a",$scope).text("上报评审会（"+ret.sbpsh_ct+"）");
				$("li[name='li_tab'][data-identity='6']>a",$scope).text("材料补正（"+ret.clbz_ct+"）");
				$("li[name='li_tab'][data-identity='7']>a",$scope).text("通过（"+ret.tg_ct+"）");
				$("li[name='li_tab'][data-identity='8']>a",$scope).text("公示（"+ret.gs_ct+"）");
				$("li[name='li_tab'][data-identity='9']>a",$scope).text("公告（"+ret.gg_ct+"）");
				$("li[name='li_tab'][data-identity='10']>a",$scope).text("发证（"+ret.fz_ct+"）");
				
				for(var i in data)
				{
					var $item=$('.list-tpl tr',$scope).clone();
					var v = data[i];
					var id = v['id'];
					$('td:eq(0)',$item).text(v['code_str']);
					$('td:eq(1)',$item).text(v['sd_unit']);
					$('td:eq(2)',$item).text(v['linkman']);
					$('td:eq(3)',$item).text(v['phone']);					
					$('td:eq(4)', $item).text(FormatDate(v['sd_time'], 'yyyy-MM-dd HH:mm'));
					$('td:eq(5)',$item).text(v['status']);
					$('td:eq(6) .sbpsh',$item).attr('data-identity','sbpsh-'+id);	
					$('td:eq(6) .yjsh',$item).attr('data-identity','yjsh-'+id);
					$('td:eq(6) .clbz',$item).attr('data-identity','clbz-'+id);
					$('td:eq(6) .shencha',$item).attr('data-identity','shencha-'+id);
					$('td:eq(6) .tg',$item).attr('data-identity','tg-'+id);	
					if(v['status']=="通过"){		
						$('td:eq(6) .sbpsh',$item).remove();	
						$('td:eq(6) .yjsh',$item).remove();	
						$('td:eq(6) .clbz',$item).remove();	
						$('td:eq(6) .shencha',$item).remove();	
						$('td:eq(6) .tg',$item).remove();		
						$('td:eq(6) .gs',$item).remove();	
						$('td:eq(6) .gg',$item).attr('data-identity','gg-'+id);		
						$('td:eq(6) .fz',$item).remove();	
					}
					if(v['status']=="公示"){		
						$('td:eq(6) .gs',$item).remove();
						$('td:eq(6) .sbpsh',$item).remove();	
						$('td:eq(6) .yjsh',$item).remove();	
						$('td:eq(6) .clbz',$item).remove();	
						$('td:eq(6) .shencha',$item).remove();	
						$('td:eq(6) .tg',$item).remove();		
						$('td:eq(6) .gs',$item).remove();	
						$('td:eq(6) .gg',$item).attr('data-identity','gs-'+id);		
						$('td:eq(6) .fz',$item).remove();	
					}
					if(v['status']=="公告"){
						$('td:eq(6) .gs',$item).remove();
						$('td:eq(6) .sbpsh',$item).remove();	
						$('td:eq(6) .yjsh',$item).remove();	
						$('td:eq(6) .clbz',$item).remove();	
						$('td:eq(6) .shencha',$item).remove();	
						$('td:eq(6) .tg',$item).remove();		
						$('td:eq(6) .gs',$item).remove();	
						$('td:eq(6) .gg',$item).remove();		
						$('td:eq(6) .fz',$item).attr('data-identity','gs-'+id);
					}	
					if(v['status']=="发证"){
						$('td:eq(6) .gs',$item).remove();
						$('td:eq(6) .sbpsh',$item).remove();	
						$('td:eq(6) .yjsh',$item).remove();	
						$('td:eq(6) .clbz',$item).remove();	
						$('td:eq(6) .shencha',$item).remove();	
						$('td:eq(6) .tg',$item).remove();		
						$('td:eq(6) .gs',$item).remove();	
						$('td:eq(6) .gg',$item).remove();		
						$('td:eq(6) .fz',$item).remove();	
					}					
					$data.append($item);
				}
				$data.show();
			}
			else {
				pageObj.set_page_count_without_action(1);
				message_box.show(ret.data,'error');
			}
		});
	}
	/*分页代码*/
	pageObj=new pagination({
		'url':'/aptitude/ajax_list_3_list',
		'page_count':9,
		'show_callback':function(page){										
			pageInit(page);
		}
	});
	$('.first', $scope).click(function() {
		pageObj.first_page();
		$('.go_num', $scope).val('1');
	});
	$('.prev', $scope).click(function() {
		pageObj.prev_page();
		$('.go_num', $scope).val(pageObj.get_page_index());
	});
	$('.next', $scope).click(function() {
		pageObj.next_page();
		$('.go_num', $scope).val(pageObj.get_page_index());
	});
	$('.last', $scope).click(function() {
		pageObj.last_page();
		$('.go_num', $scope).val(pageObj.get_page_index());
	});
	//跳转输入框
	$('.go_num', $scope).change(function() {
		var num = $(this).val();
		if (num > pageObj.get_page_count()) {
			$(this).val(pageObj.get_page_count());
		} else if (num < 1) {
			$(this).val(1);
		}
	})
	//跳转至指定页面
	$('.go_page', $scope).click(function() {
		var num = $('.go_num', $scope).val();
		pageObj.go_page(num);
		$('.go_num', $scope).val(pageObj.get_page_index());
	});

	$scope.delegate('[data-identity^="shencha"]','click',function() {
		var id=$(this).attr('data-identity').split('-')[1];
		var url = '/aptitude/show_3?id='+id;
		gDialog.fCreate({title:'在线审查',url: url,width:980}).show();
	}).delegate('[data-identity^="yjsh"]','click',function(){
		var id=$(this).attr('data-identity').split('-')[1];
		var	url='/aptitude/ajax_receipt_yjsh';
		gDialog.fConfirm('原件审核','你确定执行这个操作么？',function(ret){
			if(ret){
				$.post(url,{id:id},function(ret){
					if(ret.status==200) {
						message_box.show('操作成功','success');
						pageObj.cur_page();
					} else {
						message_box.show(ret.data,'error');
					}
				},'json');
			}
		});
	}).delegate('[data-identity^="sbpsh"]','click',function(){
		var id=$(this).attr('data-identity').split('-')[1];
		var	url='/aptitude/ajax_receipt_sbpsh';
		gDialog.fConfirm('上报评审会','你确定执行这个操作么？',function(ret){
			if(ret){
				$.post(url,{id:id},function(ret){
					if(ret.status==200) {
						message_box.show('操作成功','success');
						pageObj.cur_page();
					} else {
						message_box.show(ret.data,'error');
					}
				},'json');
			}
		});
	}).delegate('[data-identity^="clbz"]','click',function(){
		var id=$(this).attr('data-identity').split('-')[1];
		var	url='/aptitude/ajax_receipt_clbz';
		gDialog.fConfirm('材料补证','你确定执行这个操作么？',function(ret){
			if(ret){
				$.post(url,{id:id},function(ret){
					if(ret.status==200) {
						message_box.show('操作成功','success');
						pageObj.cur_page();
					} else {
						message_box.show(ret.data,'error');
					}
				},'json');
			}
		});
	}).delegate('[data-identity^="tg"]','click',function(){
		var id=$(this).attr('data-identity').split('-')[1];
		var	url='/aptitude/ajax_receipt_tg';
		gDialog.fConfirm('通过','你确定执行这个操作么？',function(ret){
			if(ret){
				$.post(url,{id:id},function(ret){
					if(ret.status==200) {
						message_box.show('操作成功','success');
						pageObj.cur_page();
					} else {
						message_box.show(ret.data,'error');
					}
				},'json');
			}
		});
	}).delegate('[data-identity^="gs"]','click',function(){
		var id=$(this).attr('data-identity').split('-')[1];
		var	url='/aptitude/ajax_receipt_gs';
		gDialog.fConfirm('公示','你确定执行这个操作么？',function(ret){
			if(ret){
				$.post(url,{id:id},function(ret){
					if(ret.status==200) {
						message_box.show('操作成功','success');
						pageObj.cur_page();
					} else {
						message_box.show(ret.data,'error');
					}
				},'json');
			}
		});
	}).delegate('[data-identity^="gg"]','click',function(){
		var id=$(this).attr('data-identity').split('-')[1];
		var	url='/aptitude/ajax_receipt_gg';
		gDialog.fConfirm('公告','你确定执行这个操作么？',function(ret){
			if(ret){
				$.post(url,{id:id},function(ret){
					if(ret.status==200) {
						message_box.show('操作成功','success');
						pageObj.cur_page();
					} else {
						message_box.show(ret.data,'error');
					}
				},'json');
			}
		});
	}).delegate('[data-identity^="fz"]','click',function(){
		var id=$(this).attr('data-identity').split('-')[1];
		var url = '/aptitude/qualification?ty=1&id='+id;
		gDialog.fCreate({title:'发证',url: url,width:800}).show();
	});
	function create_where()
	{
	    var c_unit= $("#hx_c_unit",$scope).val()||"";	    
		var tb = $("li[name='li_tab'][class='active']",$scope).attr("data-identity");	
		var where = "?c_unit="+c_unit+"&tb="+tb;
		return where;						
	}
	$("li[name='li_tab']",$scope).click(function(){
	    $("li[name='li_tab']").removeClass("active");
	    $(this).addClass("active");
	    url = '/aptitude/ajax_list_3_list'+create_where();
	    pageObj=new pagination({
			'url':url,
			'page_count':9,
			'show_callback':function(page)
			{										
			    pageInit(page);
			}
		});	
	});		
	$('.serach',$scope).click(function(){
		var url = '/aptitude/ajax_list_3_list'+create_where();
	    pageObj=new pagination({
			'url':url,
			'page_count':9,
			'show_callback':function(page)
			{										
			    pageInit(page);
			}
		});				
	});
})
</script>
